<template>
  <!--ASN/收货单-->
  <div id="Asndetails">
    <v-details
      :detailData="inputData"
      :inputConfig="inputConfig"
      :rules="rules"
      @changeData="changeData"
      ref="input"
    ></v-details>
  </div>
</template>

<script>
import details from "commons/Detail";
import baseMixin from "@/mixins/BaseMixin";

export default {
  mixins: [baseMixin],
  props: {
    inputData: {
      type: Object,
    },
  },
  name: "asnDetails",
  data() {
    return {
      inputConfig: [
        [
          {
            type: "input",
            label: this.$t("config.shipper"),
            disabled: true,
            props: "storerkey",
          },
          {
            type: "input",
            label: this.$t("in.sourcekey"),
            disabled: true,
            props: "sourcekey",
          },
          {
            type: "select",
            label: this.$t("common.type"),
            disabled: true,
            props: "sourcetype",
            options: this.getOptions("querycodeLkup/CLOSETYPE"),
          },
        ],
        [
          {
            type: "input",
            label: this.$t("in.totalqtyexpected"),
            disabled: true,
            props: "qtyexpected",
          },
          {
            type: "input",
            label: this.$t("in.qtyover"),
            disabled: true,
            props: "qtyover",
          },
        ],
        [
          {
            type: "select",
            label: this.$t("in.rtxpofromhourse"),
            props: "rtxpofromhourse",
            options: [],
          },
        ],
      ],
      rules: {
        storerkey: [{ required: true, trigger: "blur" }],
        sourcetype: [{ required: true, trigger: "blur" }],
        qtyexpected: [{ required: true, trigger: "blur" }],
      },
    };
  },
  methods: {
    changeData() {
      if (this.$parent.$parent.permissionStatus) {
        this.$parent.$parent.saveStatus = false;
      }
    },
  },
  mounted() {},
  watch: {
    "inputData.storerkey": {
      handler(data) {
        if (data != undefined) {
          this.inputConfig[2].forEach((item) => {
            if (item.props == "rtxpofromhourse") {
              item.options = this.getOptions(
                `querycodeLkupshipstore/RTXSHIPSTORE/${data}`
              );
            }
          });
        }
      },
      immediate: true,
      deep: true,
    },
  },
  components: {
    "v-details": details,
  },
};
</script>

<style scoped></style>
